package cn.zwx.member.svc.facade;

import cn.zwx.base.entity.ResponseEntity;
import cn.zwx.base.utils.PageUtil;
import cn.zwx.member.svc.dto.MemberGroupCreateDTO;
import cn.zwx.member.svc.dto.MemberGroupPageDTO;
import cn.zwx.member.svc.dto.MemberGroupUpdateDTO;
import cn.zwx.member.svc.fallback.MemberGroupFallback;
import cn.zwx.member.svc.vo.MemberGroupSimpleVO;
import cn.zwx.member.svc.vo.MemberGroupVO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author zhangwenxue
 */
@FeignClient(name = "member-svc",path = "/member/group")
public interface MemberGroupApi extends FallbackFactory<MemberGroupFallback> {

    @PostMapping("/create")
    @ApiOperation("创建用户分组")
    ResponseEntity<Long> createGroup(@Valid @RequestBody MemberGroupCreateDTO dto);

    @PutMapping("/update")
    @ApiOperation("更新用户分组")
    ResponseEntity<Boolean> updateGroup(@Valid @RequestBody MemberGroupUpdateDTO dto);

    @DeleteMapping("/delete")
    @ApiOperation("删除用户分组")
    ResponseEntity<Boolean> deleteGroup(@Valid@ApiParam(value = "用户分组id",required = true) @RequestParam("id") Long id);
    @GetMapping("/get")
    @ApiOperation("获得用户分组")
    ResponseEntity<MemberGroupVO> getGroup(@Valid@ApiParam(value = "用户分组id",required = true) @RequestParam("id") Long id);

    @GetMapping("/list-all-simple")
    @ApiOperation(value = "获取会员分组精简信息列表-只包含被开启的会员分组，主要用于前端的下拉选项")
    ResponseEntity<List<MemberGroupSimpleVO>> getSimpleGroupList();

    @GetMapping("/page")
    @ApiOperation(value = "获得用户分组分页")
    ResponseEntity<PageUtil<MemberGroupVO>> getGroupPage(@Valid MemberGroupPageDTO pageDTO);
}
